home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: news.prima.ruhr.de!oscar!patrick
- From: patrick@oscar.prima.ruhr.de (Patrick Mau)
- Subject: Quotes in C comments
- X-Newsreader: TIN [version 1.2 PL2]
- Organization: Private Linux Site ( Prima e.V )
- Message-ID: <Do6nn5.5rE@oscar.prima.ruhr.de>
- Date: Wed, 13 Mar 1996 01:47:29 GMT
-
- Hi there,
-
- I had a really funny problem with quotes in C programs:
-
- The question is:
- How should a compiler handle the following comments
-
- First Example:
-
- /*
- * printf( "/* funny printf */" );
- * ^^--- Point A
- */
-
- Second Example:
-
- /*
- * You can't do xyz here
- * ^--- Point B
- */
-
- In the first example the compiler could stop at point A thinking the
- comment ends at that point. This would be the case if the compiler
- doesn't check quotes within comments. ( they are usually ignored. )
-
- In the second example ( _that_ happened to me with gcc 2.7.2 )
- the compiler complains about an unterminated character constant
- at EOF and says it could be at point B.
-
- How should a good compiler handle those kinds of comments.
- Should it check for quotes within comments or not ?
-
- Best regards ...
- ... Patrick
-